JavaScript

A5.u.colorparse Method

Syntax

A5.u.color.parse(color)

Returns

colorobject

The color components.

rnumber

The "red" value of the color.

gnumber

The "green" value of the color.

bnumber

The "blue" value of the color.

hnumber

The "hue" value of the color.

snumber

The "saturation" value of the color.

lnumber

The "luminance" value of the color.

anumber

The "alpha" value of the color.

colorstring

The color to parse.

Description

Parse a CSS color string into the individual color components.

Discussion

This method will take an arbitrary CSS color string and return the individual values for each color part. This will include the "red", "green", "blue", "hue", "saturation", "luminance" and "alpha" components.

Example

var c = A5.u.color.parse('rgb(100,50,0)');
// c = {"h":30,"s":100,"l":19.61,"r":100,"g":50,"b":0,"a":1}